home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / lib / geometry / transform3 / tm3copy.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-29  |  1.6 KB  |  60 lines

  1. /* Copyright (c) 1992 The Geometry Center; University of Minnesota
  2.    1300 South Second Street;  Minneapolis, MN  55454, USA;
  3.    
  4. This file is part of geomview/OOGL. geomview/OOGL is free software;
  5. you can redistribute it and/or modify it only under the terms given in
  6. the file COPYING, which you should have received along with this file.
  7. This and other related software may be obtained via anonymous ftp from
  8. geom.umn.edu; email: software@geom.umn.edu. */
  9.  
  10. /* Authors: Charlie Gunn, Pat Hanrahan, Stuart Levy, Tamara Munzner, Mark Phillips */
  11.  
  12. #include "transform3.h"
  13. #include <math.h>
  14.  
  15. /*-----------------------------------------------------------------------
  16.  * Function:    Tm3Copy
  17.  * Description:    copy a transform
  18.  * Args:    Tsrc: source transform  (INPUT)
  19.  *        Tdst: destination transform (OUTPUT)
  20.  * Returns:    nothing
  21.  * Author:    hanrahan, mbp
  22.  * Date:    Thu Aug  8 15:40:09 1991
  23.  * Notes:    
  24.  */
  25. void
  26. Tm3Copy( Tsrc, Tdst )
  27.     Transform3 Tsrc, Tdst;
  28. {
  29.     bcopy( (char *)Tsrc, (char *)Tdst, sizeof(Transform3) );
  30. }
  31.  
  32. /*-----------------------------------------------------------------------
  33.  * Function:    Tm3Compare
  34.  * Description:    compare 2 transforms
  35.  * Args:    T1, T2: the two transforms
  36.  *        tol: tolerance
  37.  * Returns:    1 if equal, 0 if not
  38.  * Author:    hanrahan, mbp
  39.  * Date:    Thu Aug  8 15:40:09 1991
  40.  * Notes:    "equal" means corresponding elements are within tol of
  41.  *        each other.
  42.  */
  43. int
  44. Tm3Compare( T1, T2, tol )
  45.      Transform3 T1, T2;
  46.      float tol;
  47. {
  48.     int i,j;
  49.     double d;
  50.     for (i=0; i<4; ++i)
  51.       for (j=0; j<4; ++j) {
  52.     d = T1[i][j] - T2[i][j];
  53.     if (fabs(d) > tol) {
  54.       return 0;
  55.     }
  56.       }
  57.     return 1;
  58. }
  59.  
  60.